import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

/**
 * Created by asd73 on 2017/8/17.
 */
public class Map_Iterator {
    public static void main(String[] args){
        Map<Integer,String> stringMap = new HashMap<Integer,String>();
        stringMap.put(1,"hello");
        stringMap.put(2,"world");
        stringMap.put(3,"Amoy");
        Set<Map.Entry<Integer,String>> set = stringMap.entrySet();
        Iterator<Map.Entry<Integer,String>> iterator = set.iterator();
        while (iterator.hasNext()){
            Map.Entry<Integer,String> map = iterator.next();
            System.out.println("key="+map.getKey()+","+"value="+map.getValue());
        }
    }
}
